package com.wyl.auth.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import lombok.Data;

import javax.persistence.*;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * @Description 菜单表
 * @Author WuYiLong
 * @Date 2024-12-02
 */
@Data
@TableName("sys_menu")
@Entity
@Table(name="sys_menu")
@org.hibernate.annotations.Table(appliesTo = "sys_menu",comment = "菜单表")
public class SysMenu extends Model<SysMenu> {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.ASSIGN_ID)
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(columnDefinition = "bigint comment '主键id'")
    private Long id;

    @Column(columnDefinition = "varchar(200) comment '路径'")
    private String path;

    @Column(columnDefinition = "varchar(200) comment '名称'")
    private String name;

    @Column(columnDefinition = "varchar(255) comment '组件'")
    private String component;

    @Column(columnDefinition = "varchar(200) comment '重定向路径'")
    private String redirectPath;

    @Column(columnDefinition = "varchar(200) comment '图标'")
    private String icon;

    @Column(columnDefinition = "varchar(200) comment '中文名称'")
    private String label;

    @Column(columnDefinition = "bigint comment '父级id'")
    private Long parentId;

    @Column(columnDefinition = "tinyint comment '是否删除？1是，0否'")
    private Integer deleted;

    @Column(columnDefinition = "bigint comment '创建人id'")
    private Long createUserId;

    @Column(columnDefinition = "int comment '更新人id'")
    private Long updateUserId;

    @Column(columnDefinition = "datetime comment '创建时间'")
    private LocalDateTime createTime;

    @Column(columnDefinition = "datetime comment '更新时间'")
    private LocalDateTime updateTime;

    @Column(columnDefinition = "tinyint comment '排序号'")
    private Integer sort;

    @Column(columnDefinition = "tinyint comment '菜单类型：1目录，2菜单，3按钮'")
    private Integer type;

    @Column(columnDefinition = "tinyint comment '是否隐藏：0否，1是'")
    private Integer isHidden;

    @Column(columnDefinition = "varchar(255) comment '权限标识'")
    private String code;

    @Column(columnDefinition = "varchar(255) comment '访问路径' ")
    private String url;

    @Override
    public Serializable pkVal() {
        return this.id;
    }

}
